package com.sun.action;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import com.baidu.yun.push.exception.PushClientException;
import com.baidu.yun.push.exception.PushServerException;
import com.opensymphony.xwork2.ActionSupport;
import com.sun.dao.NoticeInfoMapper;
import com.sun.po.NoticeInfo;
import com.sun.push.BaiduPushMessage;
import com.sun.util.ApplicationContextFactory;

import org.apache.struts2.interceptor.ParameterAware;
import org.apache.struts2.json.annotations.JSON;
import org.springframework.context.ApplicationContext;


public class NoticeInfoAction extends ActionSupport implements ParameterAware {

	private static final long serialVersionUID = -9038030296164414041L;
	
	private Map<String, String[]> parameters; //接收参数
	private List<NoticeInfo> dataMap;
	
	public String getNoticeInfo(){
	/*	String[] params1 = (String[]) parameters.get("myJson");//接收myJson参数
		String json = new String(params1[0]);
		System.out.println(json);*/

		ApplicationContext factory = ApplicationContextFactory.getInstance();// 初始化配置文件
		NoticeInfoMapper myMapper = (NoticeInfoMapper) factory.getBean("noticeInfoMapper");
		List<NoticeInfo> infoList = myMapper.getNoticeInfo();
		dataMap = infoList;
		return SUCCESS;
	}

	public List<NoticeInfo> getDataMap() {
		return dataMap;
	}
	
	public void setDataMap(List<NoticeInfo> dataMap) {
		this.dataMap = dataMap;
	}	

	@Override
	public void setParameters(Map<String, String[]> arg0) {
		// TODO Auto-generated method stub
		this.parameters = arg0;
	}

}
